package ${package}.${moduleName}.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import ${package}.${moduleName}.po.${ClassName}PO;
import ${package}.${moduleName}.service.${ClassName}Service;
import ${package}.${moduleName}.query.${ClassName}Query;
import ${package}.${moduleName}.vo.${ClassName}VO;
import com.qm.qfc.common.rest.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;
import java.util.List;

/**
* ${tableComment}
*
* @author ${author} ${email}
* @since ${version} ${date}
*/
@RestController
@RequestMapping("${moduleName}/${functionName}")
@Api(value="${tableComment}")
@AllArgsConstructor
public class ${ClassName}Controller {
    private final ${ClassName}Service ${className}Service;



    @GetMapping("/list")
    @ApiOperation("列表")
    public Result<List<${ClassName}VO>> list${ClassName}(@Valid ${ClassName}Query ${className}Query) {
        List<${ClassName}VO> ${className}List = ${className}Service.list${ClassName}(${className}Query);

        return Result.success(${className}List);
    }

    @GetMapping("/listPage")
    @ApiOperation("列表分页-mybatis-plus框架")
    public Result<Page<${ClassName}VO>> listPage${ClassName}(@Valid ${ClassName}Query ${className}Query) {
        Page<${ClassName}VO> ${className}Page = ${className}Service.listPage${ClassName}(${className}Query);

        return Result.success(${className}Page);
    }

    @GetMapping("/detail")
    @ApiOperation("详情")
    public Result<${ClassName}VO> detail(String id) {
        ${ClassName}VO ${className}VO = ${className}Service.detail(id);

        return Result.success(${className}VO);
        }

        @PostMapping("/save")
        @ApiOperation("保存")
        public Result<String> save${ClassName}(@RequestBody @Valid ${ClassName}VO ${className}VO) {
            ${className}Service.save${ClassName}(${className}VO);

            return Result.success("success");
            }

    @PutMapping("/update")
    @ApiOperation("修改")
    public Result<String> update${ClassName}(@RequestBody @Valid ${ClassName}VO ${className}VO) {
        ${className}Service.update${ClassName}(${className}VO);

        return Result.success("success");
        }


    @PostMapping("/delete")
    @ApiOperation("删除")
    public Result<String> delete(@RequestBody List<String> idList) {
        ${className}Service.delete${ClassName}(idList);

        return Result.success("success");
    }
}